-
Notifications
You must be signed in to change notification settings - Fork 264
[ONNX] Add MatMul for FBC/BC #3657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ONNX] Add MatMul for FBC/BC #3657
Conversation
fbec013 to
c7c68ff
Compare
1f0d75c to
66ef2c4
Compare
| op_names = ["MatMul"] | ||
| hw_config_names = [HWConfigOpName.MATMUL] | ||
| weight_channel_axis = -1 # For port_id=1 | ||
| bias_port_id = 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not apply to the MatMul ONNX operation, as it does not accept a bias input. Reference: https://onnx.ai/onnx/operators/onnx__MatMul.html
| if bias_value.ndim > 1: | ||
| # Make index positive | ||
| output_channel_axis = range(bias_value.ndim)[output_channel_axis] | ||
| input_channel_axis = range(bias_value.ndim)[input_channel_axis] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was moved into create_input_data() because this method does not work properly with a negative channel_axis. The output_channel_axis is converted to positive inside mean_per_channel() method.
nikita-savelyevv
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've run FBC on a couple of ONNX models and I see that the number of constants that FBC is applied to for ONNX and OpenVINO cases differs significantly with the numbers being higher for ONNX backend. Is this expected?
e9f7ddb to
babda33
Compare
|
Build post_training_quantization # 740 |
Changes
Add support for the
MatMuloperation in the Fast Bias/Bias Correction algorithm.Reason for changes
The Fast Bias/Bias Correction algorithm is not applied to the
MatMul->Addsubgraph in which one of the inputs to the Add operation is a constant. In this case, theMatMuloperation is not considered as having a bias, so the algorithm is not applied.Related tickets
Ref: 135433
Tests